function wordPaste() {
    CKEDITOR.instances["document"].on('instanceReady', function () {
        this.on('afterPaste', function () {
            var editor = CKEDITOR.instances.document;
            var content = editor.getData();
            var newContent = content;
            content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (filepath, match) {
                console.log(filepath);
                console.log(match);
                $.ajax({
                    type: "POST",
                    url: 'http://127.0.0.1:12378/word/wordPaste',
                    data: {filepath: match},
                    dataType: 'jsonp',
                    jsonp: 'callback',
                    success: function (result) {
                        if ("yes" == result.success) {
                            var base64 = result.data;
//	    	 				newContent = newContent.replace(match,base64);
// 	   	     			 	editor.setData(newContent);
                            $.ajax({
                                type: "POST",
                                url: uploadUrl,
                                data: {
                                    strBase64: base64
                                },
                                async: false,
                                dataType: "json",
                                success: function (result) {
                                    if ("no" == result.success) {
                                        alert(result.message);
                                        return;
                                    }
                                    var imgUrl = result.data;
                                    console.log(imgUrl);
                                    newContent = newContent.replace(match, path + "/" + imgUrl);
                                    editor.setData(newContent);
                                }
                            });
                        }
                    }
                });
            });
        });
    });
}

wordPaste();